package com.veo.config;

import com.veo.interceptor.AdminLoginInterceptor;
import com.veo.interceptor.UserLoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Component
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

//    @Override
//    public void addResourceHandlers(ResourceHandlerRegistry registry) {
//        registry.addResourceHandler("/public/**").addResourceLocations("file:///D:images/");
//    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new UserLoginInterceptor()).addPathPatterns("/order/**","/cart/**");
        registry.addInterceptor(new AdminLoginInterceptor())
                .addPathPatterns("/adminOrder/**","/admin/**","/adminBook/**");
    }
}
